<!-- 商品的图文详情组件 -->
<template>
  <div class="goods-info">
    <div v-for="(item, index) in list" :key="index">
      <h3 class="info-title">{{ item.title }}</h3>
      <p class="info-desc">{{ item.desc }}</p>
      <ul v-if="item.list" class="info-imgs">
        <li v-for="(i, key) in item.list" :key="key">
          <!-- <img :src="i" alt="" @load="imageLoad" /> -->
          <img v-lazy="i" :key="i" alt="" @load="imageLoad" />
        </li>
      </ul>
    </div>
    <slot></slot>
  </div>
</template>

<script>
export default {
  name: "",
  props: {
    list: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  data() {
    return {};
  },
  components: {},
  methods: {
    imageLoad(e) {
      let path = this.$route.path;
      this.$bus.$emit("goodsImageLoad", { path, e });
    }
  }
};
</script>

<style scoped>
.goods-info {
  background: #fff;
}
.info-title {
  padding: 10px 10px 0 10px;
}
.info-desc {
  padding: 10px;
}
.info-imgs {
  list-style: none;
}
.info-imgs li img {
  width: 100%;
}
</style>
